home *** CD-ROM | disk | FTP | other *** search
/ PC Media 23 / PC MEDIA CD23.iso / share / prog / dclib500 / vergif.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-12-19  |  4.0 KB  |  104 lines

  1. { GifUtl.pas - (c)Copyright 1993 Sean Wenzel
  2. Users are given the right to use/modify and distribute this source code as
  3. long as credit is given where due.  I would also ask that anyone who makes
  4. use of this source/program drop me a line at my CompuServe address of
  5. 71736,1245.  Just curious...
  6.  
  7. The unit was written using Borland Pascal v7.0 but I think it should work
  8. with Turbo Pascal down to 5.5 at the most (or least?).
  9. This unit has only been tested on my system - an Everex Tempo 386DX
  10. with its built in SVGA adapter.  If anyone finds/fixes any bugs please
  11. let me know. (Feel free to send a copy of any code too)
  12. I have also only tested 3 or 4 256,16, and 2 color interlaced and non-
  13. interlaced images. (was enough for my needs)
  14.  
  15.  
  16. Some of the code is very loosely based on DECODER.C (availble online)
  17. so credit should be given to Steven A. Bennett and Steve Wilhite
  18.  
  19. The unit is set up to use BGI256.BGI (inlcuded) which is available on CIS
  20. in the BPASCAL forum library.  The graphics initialization tries to start
  21. up in 640 by 480 mode.  If an error occurs it'll go down to 320x200
  22. automatically (well - it should).  For higher res modes change the variable
  23. GraphMode in the InitGraphics procedure to 3 for 800x600 and 4 for 1024x768.
  24.  
  25. A sample program (GIF.PAS) is provided to demostrate the use of this unit.
  26. Basically declare a pointer to the TGIF object then initialize it using a
  27. line such as TheGif := New(PGif, Init('agif'));  You can then check
  28. TheGif^.Status for any errors and/or view the GIF headers and ColorTables.
  29. To switch to Graphics mode and show the GIF image use TheGif^.Decode(True)
  30. True tells it to beep when done(or boop if some sort of error occured).
  31. When finished use Dispose(TheGif, Done) to switch back to textmode and get
  32. rid of the object.
  33.  
  34.  
  35. If anyone cares to speed up the image decoding I'd suggest writing
  36. TGIF.NextCode in assembler.  The routine is the most heavily called in the
  37. unit while decoding and on my sytem took up about 5 seconds out of 12 when
  38. I profiled it. (send me a copy if you can)
  39.  
  40. I have practically commented every line so that the source should be very
  41. readable and easy to follow.  Great for learning about GIF's and LZW
  42. decompression.
  43.  
  44.  
  45. Any problems or suggestions drop me a line
  46.  
  47. Good luck...
  48.                                                 -Sean
  49.  
  50. (almost forgot)
  51. "The Graphics Interchange Format(c) is the Copyright property of
  52.  CompuServe Incorporated. GIF(sm) is a Service Mark property of
  53.  CompuServe Incorporated."
  54.  
  55. }
  56. program Gif;
  57.  
  58. uses GifUnit, CRT, Dos;
  59.  
  60. var
  61.     A: string;
  62.     ElGif: PGif;
  63.         Horas, Minutos, Segundos, Sec100: word;
  64.     H, M, S, S100: word;
  65. begin
  66.         D := 0; (* Determina que se va usar el VGA256.BGI *)
  67.         M := 1; (* Modo Gráfico *)
  68.         Writeln;
  69.         TextColor(15);
  70.         Writeln('VERGIF Versión 1.00 para DOS');
  71.         Writeln('Shareware 1993 David Carrero Fernández-Baillo');
  72.         TextColor(7);
  73.         Writeln;
  74.     Writeln('Ejemplo para usar librería GIFUNIT.PAS');
  75.         Writeln('Este Ejemplo requiere VGA256.BGI');
  76.     Writeln('');
  77.  
  78.     if ParamCount <> 1 then
  79.     begin
  80.         Writeln('uso: C:>gif <nombregif>[.gif] a ejecutar...');
  81.         Exit;
  82.     end;
  83.     ElGif := New(PGif, Init(paramstr(1)));
  84.  
  85.     GetTime(Horas, Minutos, Segundos, Sec100);
  86.     ElGif^.Decode(True);
  87.     GetTime(H, M, S, S100);
  88.     Readln(A);
  89.     Dispose(ElGif, Done);
  90.  
  91.     Writeln('Comienzo : ',Horas,':',Minutos,':',Segundos,':',Sec100);
  92.     Writeln('Terminado: ',H,':',M,':',S,':',S100);
  93.     while not(KeyPressed) do;
  94.  
  95.         Writeln('"Este formato gráfico es Copyright del propietario');
  96.         Writeln('CompuServe Incorporated. GIF(sm) es propiedad de');
  97.         Writeln('CompuServe Incorporated."');
  98.         Writeln('Créditos:');
  99.         Writeln('Esta Librería es (c)Copyright 1993 Sean Wenzel');
  100.         Writeln('Users are given the right to use/modify and distribute this');
  101.         Writeln('source code as long as credit is given where due.');
  102.         Writeln('Ver principio de VERGIF.PAS.');
  103.  
  104. end.